//
//  CarModifyEditorViewController.m
//  HondaPro_2
//
//  Created by ht on 13-7-20.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "CarModifyEditorViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "webConfig.h"
#import "webService.h"
#import "HelpClass.h"
#import "SVProgressHUD.h"
@interface CarModifyEditorViewController ()

@end

@implementation CarModifyEditorViewController
{
    BOOL _warrantyChoose;
    BOOL _TypeXy;
    BOOL _TypePt;
}
@synthesize subNewTableView = _subNewTableView;

@synthesize carframe = _carframe;                       //车架号
@synthesize manufacturer = _manufacturer;               //生产厂家
@synthesize licenseplate = _licenseplate;               //车牌号
@synthesize model = _model;                             //型号
@synthesize engineField = _engineField;               //发动机号
@synthesize transmissionField = _transmissionField;   //变速箱号
@synthesize Inparagraph = _Inparagraph;                 //年款
@synthesize exhaust = _exhaust;                         //排气量
@synthesize transmissionType = _transmissionType;       //变速箱类型

@synthesize insideColor = _insideColor;              //内装颜色
@synthesize carClolr = _carClolr;                    //车辆颜色
@synthesize keyNumber = _keyNumber;                  //钥匙号
@synthesize countriesCodeName = _countriesCodeName;  //国家代码
@synthesize carUse = _carUse;                        //车辆用途
@synthesize warrantyNumber = _warrantyNumber;        //保修序号
@synthesize monthsOfNumber = _monthsOfNumber;        //保修月数

@synthesize insuranceCompany = _insuranceCompany;    //保险公司
@synthesize PurchaseDate = _PurchaseDate;            //保险购买日期
@synthesize DueDate = _DueDate;                      //保险到期日期
@synthesize checkStartDate = _checkStartDate;        //年度检查开始日期
@synthesize buyDate = _buyDate;                      //购买日期
@synthesize registrationDate = _registrationDate;    //上牌日期
@synthesize firstTimeDate = _firstTimeDate;          //第一次来厂日期
@synthesize lastComingMileage = _lastComingMileage;                    //最后一次来场里程

@synthesize backgroundView  = _backgroundView;
@synthesize carMasterButton = _carMasterButton;
@synthesize saveButton = _saveButton;
@synthesize WarrantyOptions = _WarrantyOptions;      //是否保修车辆选择框

@synthesize baoXiuDaoQi = _baoXiuDaoQi;
@synthesize layerLabel = _layerLabel;
@synthesize baoXiuDaoQiRi = _baoXiuDaoQiRi;
@synthesize baoXiuLiChen = _baoXiuLiChen;
@synthesize liChenShuRu = _liChenShuRu;
@synthesize keHuPopView = _keHuPopView;

//*弹出框内容
@synthesize queryTableView = _queryTableView;
@synthesize queryNumberField = _queryNumberField;
@synthesize queryNameField = _queryNameField;
@synthesize queryButton = _queryButton;
//数据字典
@synthesize carModifyDataDit = _carModifyDataDit;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self)
    {
        
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(douBiZhaoShaoFei:) name:@"douBiZhaoShaoFei" object:nil];

    [self addNotification];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.backgroundView = [[UIView alloc]initWithFrame:CGRectMake(70, 60, 1024-70-70, 768-55)];
    [self.backgroundView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:self.backgroundView];
    
    self.subNewTableView = [[UITableView alloc]initWithFrame:CGRectMake(100, 575, 783, 120) style:UITableViewStylePlain];
    [self.subNewTableView setScrollEnabled:NO];
    [self.subNewTableView setDataSource:self];
    [self.subNewTableView setDelegate:self];
    [self.backgroundView addSubview:self.subNewTableView];
    
    [self loadfixedPicture];
    [self loadbuttonPictuerTwo];
    [self Avarietyoftextfield];
    [self loadbuttonPictuer];
    
    //注册键盘即将消失的消息
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardHide:)
                                                 name:UIKeyboardDidHideNotification
                                               object:nil];
    
    _TypeXy = YES;
    _TypePt = NO;
    
//    NSLog(@"内装颜色的数组：%@",self.neiZhuangColorArray);
//    NSLog(@"车辆颜色的数组：%@",self.cheLiangColorArray);
}
-(void)douBiZhaoShaoFei:(NSNotification *)notification
{
    self.biaoGeDit = (NSMutableDictionary *)notification.object;
    
    NSMutableDictionary *shabiDit1 = [[NSMutableDictionary alloc]init];
    [shabiDit1 setObject:[self.biaoGeDit objectForKey:@"customerId"] forKey:@"customerId"];
    [shabiDit1 setObject:[self.biaoGeDit objectForKey:@"customerName"] forKey:@"customerName"];
    [shabiDit1 setObject:[self.biaoGeDit objectForKey:@"natureName"] forKey:@"natureName"];
    [shabiDit1 setObject:[self.biaoGeDit objectForKey:@"mobile"] forKey:@"mobile"];
    [shabiDit1 setObject:[self.biaoGeDit objectForKey:@"tel"] forKey:@"tel"];
    [shabiDit1 setObject:[self.biaoGeDit objectForKey:@"fax"] forKey:@"fax"];
    [shabiDit1 setObject:[self.biaoGeDit objectForKey:@"address"] forKey:@"address"];
    
    NSMutableDictionary *shabiDit2 = [[NSMutableDictionary alloc]init];
    [shabiDit2 setObject:[self.biaoGeDit objectForKey:@"customerId"] forKey:@"customerId"];
    [shabiDit2 setObject:[self.biaoGeDit objectForKey:@"customerName"] forKey:@"customerName"];
    [shabiDit2 setObject:[self.biaoGeDit objectForKey:@"natureName"] forKey:@"natureName"];
    [shabiDit2 setObject:[self.biaoGeDit objectForKey:@"mobile"] forKey:@"mobile"];
    [shabiDit2 setObject:[self.biaoGeDit objectForKey:@"tel"] forKey:@"tel"];
    [shabiDit2 setObject:[self.biaoGeDit objectForKey:@"fax"] forKey:@"fax"];
    [shabiDit2 setObject:[self.biaoGeDit objectForKey:@"address"] forKey:@"address"];
    
    NSMutableDictionary *shabiDit3 = [[NSMutableDictionary alloc]init];
    [shabiDit3 setObject:[self.biaoGeDit objectForKey:@"customerId"] forKey:@"customerId"];
    [shabiDit3 setObject:[self.biaoGeDit objectForKey:@"customerName"] forKey:@"customerName"];
    [shabiDit3 setObject:[self.biaoGeDit objectForKey:@"natureName"] forKey:@"natureName"];
    [shabiDit3 setObject:[self.biaoGeDit objectForKey:@"mobile"] forKey:@"mobile"];
    [shabiDit3 setObject:[self.biaoGeDit objectForKey:@"tel"] forKey:@"tel"];
    [shabiDit3 setObject:[self.biaoGeDit objectForKey:@"fax"] forKey:@"fax"];
    [shabiDit3 setObject:[self.biaoGeDit objectForKey:@"address"] forKey:@"address"];

    
    NSMutableArray *shabi = [[NSMutableArray alloc]initWithObjects:shabiDit1,shabiDit2,shabiDit3, nil];
    
    self.CarModifyDataArray = shabi;
    
    [self.subNewTableView reloadData];
    
    NSLog(@"333333驾驶员：%@",self.CarModifyDataArray);
}
-(void)loadbuttonPictuer
{
    self.engineField = [[UITextField alloc]initWithFrame:CGRectMake(100, 235, 160, 30)];      //发动机号
    self.engineField.borderStyle = UITextBorderStyleLine;
    self.engineField.textColor = [UIColor grayColor];
    self.engineField.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.engineField.text = [self.carModifyDataDit objectForKey:@"engineNumber"];
    [self.engineField setTextAlignment:NSTextAlignmentCenter];
    self.engineField.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.backgroundView addSubview:self.engineField];
    
    self.transmissionField = [[UITextField alloc]initWithFrame:CGRectMake(100, 279, 160, 30)];      //变速箱号
    self.transmissionField.borderStyle = UITextBorderStyleLine;
    self.transmissionField.textColor = [UIColor grayColor];
    self.transmissionField.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.transmissionField.text = [self.carModifyDataDit objectForKey:@"gearBoxNumber"];
    [self.transmissionField setTextAlignment:NSTextAlignmentCenter];
    self.transmissionField.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.backgroundView addSubview:self.transmissionField];
    
    UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(100, 412, 160, 30)];       //变速箱类型
    [label3 setBackgroundColor:[UIColor clearColor]];
    label3.layer.borderColor = [[UIColor grayColor]CGColor];
    label3.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label3];
    self.transmissionType = [UIButton buttonWithType:UIButtonTypeCustom];//变速箱类型
    [self.transmissionType setFrame:CGRectMake(101, 413, 158, 28)];
    [self.transmissionType setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.transmissionType addTarget:self action:@selector(transmissionType:) forControlEvents:UIControlEventTouchUpInside];
    [self.transmissionType setTitle:[self.carModifyDataDit objectForKey:@"gearBoxType"] forState:UIControlStateNormal];
    self.transmissionType.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.transmissionType setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.transmissionType];
    
    self.importantNotice = [[UITextField alloc]initWithFrame:CGRectMake(100, 455, 740, 30)];      //重要提示
    self.importantNotice.borderStyle = UITextBorderStyleLine;
    self.importantNotice.textColor = [UIColor grayColor];
    self.importantNotice.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.importantNotice.text = [self.carModifyDataDit objectForKey:@"importantNotice"];
    [self.importantNotice setTextAlignment:NSTextAlignmentCenter];
    self.importantNotice.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.importantNotice.delegate = self;
    [self.backgroundView addSubview:self.importantNotice];
    
    self.remark = [[UITextField alloc]initWithFrame:CGRectMake(100, 496, 740, 30)];      //备注
    self.remark.borderStyle = UITextBorderStyleLine;
    self.remark.textColor = [UIColor grayColor];
    self.remark.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.remark.text = [self.carModifyDataDit objectForKey:@"remark"];
    [self.remark setTextAlignment:NSTextAlignmentCenter];
    self.remark.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.remark.delegate = self;
    [self.backgroundView addSubview:self.remark];
    
    UILabel *label4 = [[UILabel alloc]initWithFrame:CGRectMake(365, 53, 160, 30)];        //内装颜色
    [label4 setBackgroundColor:[UIColor clearColor]];
    label4.layer.borderColor = [[UIColor grayColor]CGColor];
    label4.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label4];
    self.insideColor = [UIButton buttonWithType:UIButtonTypeCustom];//内装颜色
    [self.insideColor setFrame:CGRectMake(366, 54, 158, 28)];
    [self.insideColor setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.insideColor addTarget:self action:@selector(insideColor:) forControlEvents:UIControlEventTouchUpInside];
    [self.insideColor setTitle:[self.carModifyDataDit objectForKey:@"insideColor"] forState:UIControlStateNormal];
    self.insideColor.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.insideColor setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.insideColor];
    
    UILabel *label5 = [[UILabel alloc]initWithFrame:CGRectMake(365, 97, 160, 30)];         //车辆颜色
    [label5 setBackgroundColor:[UIColor clearColor]];
    label5.layer.borderColor = [[UIColor grayColor]CGColor];
    label5.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label5];
    self.carClolr = [UIButton buttonWithType:UIButtonTypeCustom];//车辆颜色
    [self.carClolr setFrame:CGRectMake(366, 98, 158, 28)];
    [self.carClolr setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.carClolr addTarget:self action:@selector(carClolr:) forControlEvents:UIControlEventTouchUpInside];
    [self.carClolr setTitle:[self.carModifyDataDit objectForKey:@"carColor"] forState:UIControlStateNormal];
    self.carClolr.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.carClolr setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.carClolr];
#pragma mark - 车主选择与保存按钮
    self.carMasterButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 578, 100, 38)];
    [self.carMasterButton setTitle:@"车 主" forState:UIControlStateNormal];
    [self.carMasterButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.carMasterButton setBackgroundImage:[UIImage imageNamed:@"改-灰but.png"] forState:UIControlStateNormal];
    [self.carMasterButton addTarget:self action:@selector(carMasterButton:) forControlEvents:UIControlEventTouchUpInside];
    self.carMasterButton.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [self.backgroundView addSubview:self.carMasterButton];
    
    self.carUserButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 618, 100, 38)];
    [self.carUserButton setTitle:@"驾驶员" forState:UIControlStateNormal];
    [self.carUserButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.carUserButton setBackgroundImage:[UIImage imageNamed:@"改-灰but.png"] forState:UIControlStateNormal];
    [self.carUserButton addTarget:self action:@selector(carUserButton:) forControlEvents:UIControlEventTouchUpInside];
    self.carUserButton.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [self.backgroundView addSubview:self.carUserButton];
    
    self.carDrivingButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 658, 100, 38)];
    [self.carDrivingButton setTitle:@"使用者" forState:UIControlStateNormal];
    [self.carDrivingButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.carDrivingButton setBackgroundImage:[UIImage imageNamed:@"改-灰but.png"] forState:UIControlStateNormal];
    [self.carDrivingButton addTarget:self action:@selector(carDrivingButton:) forControlEvents:UIControlEventTouchUpInside];
    self.carDrivingButton.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:14];
    [self.backgroundView addSubview:self.carDrivingButton];
    
    self.saveButton = [[UIButton alloc]initWithFrame:CGRectMake(865, 60, 75, 33)];
    [self.saveButton setBackgroundImage:[UIImage imageNamed:@"ht05-1.png"] forState:UIControlStateNormal];
    [self.saveButton setTitle:@"保 存" forState:UIControlStateNormal];
    [self.saveButton setTintColor:[UIColor whiteColor]];
    self.saveButton.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.saveButton addTarget:self action:@selector(saveButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.saveButton];
}
-(void)loadbuttonPictuerTwo
{
    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(100, 97, 160, 30)];     //生产厂家
    [label1 setBackgroundColor:[UIColor clearColor]];
    label1.layer.borderColor = [[UIColor grayColor]CGColor];
    label1.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label1];
    self.manufacturer = [UIButton buttonWithType:UIButtonTypeCustom];//生产厂家
    [self.manufacturer setFrame:CGRectMake(101, 98, 158, 28)];
    [self.manufacturer setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.manufacturer addTarget:self action:@selector(manufacturer:) forControlEvents:UIControlEventTouchUpInside];
    if([[self.carModifyDataDit objectForKey:@"manufactureName"]isEqualToString:@"01"])
    {
        [self.manufacturer setTitle:@"[01] 广汽乘用车" forState:UIControlStateNormal];
    }
    if([[self.carModifyDataDit objectForKey:@"manufactureName"]isEqualToString:@"02"])
    {
        [self.manufacturer setTitle:@"[02] 其他" forState:UIControlStateNormal];
    }
    if([[self.carModifyDataDit objectForKey:@"manufactureName"]isEqualToString:@"03"])
    {
        [self.manufacturer setTitle:@"[03] " forState:UIControlStateNormal];
    }
    if([[self.carModifyDataDit objectForKey:@"manufactureName"]isEqualToString:@"99"])
    {
        [self.manufacturer setTitle:@"[99] 其他厂家" forState:UIControlStateNormal];
    }
    self.manufacturer.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.manufacturer setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.manufacturer];
    
    UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(100, 190, 160, 30)];        //型号
    [label2 setBackgroundColor:[UIColor clearColor]];
    label2.layer.borderColor = [[UIColor grayColor]CGColor];
    label2.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label2];
    self.model = [UIButton buttonWithType:UIButtonTypeCustom];//型号
    [self.model setFrame:CGRectMake(101, 191, 158, 28)];
    [self.model setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.model addTarget:self action:@selector(model:) forControlEvents:UIControlEventTouchUpInside];
    [self.model setTitle:[self.carModifyDataDit objectForKey:@"carType"] forState:UIControlStateNormal];
    self.model.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.model setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.model];
    
    UILabel *label3 = [[UILabel alloc]initWithFrame:CGRectMake(365, 190, 160, 30)];     //国家代码
    [label3 setBackgroundColor:[UIColor clearColor]];
    label3.layer.borderColor = [[UIColor grayColor]CGColor];
    label3.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label3];
    UIImageView *xingxingimage7 = [[UIImageView alloc]initWithFrame:CGRectMake(275, 195, 10, 10)];
    [xingxingimage7 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage7];

    self.countriesCodeName = [UIButton buttonWithType:UIButtonTypeCustom];//国家代码
    [self.countriesCodeName setFrame:CGRectMake(366, 191, 158, 28)];
    [self.countriesCodeName setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.countriesCodeName addTarget:self action:@selector(countriesCodeName:) forControlEvents:UIControlEventTouchUpInside];
    if([[self.carModifyDataDit objectForKey:@"countryCode"]isEqualToString:@"CHN"])
    {
        [self.countriesCodeName setTitle:@"中国" forState:UIControlStateNormal];
    }
    if([[self.carModifyDataDit objectForKey:@"countryCode"]isEqualToString:@"JPN"])
    {
        [self.countriesCodeName setTitle:@"日本" forState:UIControlStateNormal];
    }
    self.countriesCodeName.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.countriesCodeName setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.countriesCodeName];
    
    UILabel *label4 = [[UILabel alloc]initWithFrame:CGRectMake(365, 235, 160, 30)];     //车辆用途
    [label4 setBackgroundColor:[UIColor clearColor]];
    label4.layer.borderColor = [[UIColor grayColor]CGColor];
    label4.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label4];
    self.carUse = [UIButton buttonWithType:UIButtonTypeCustom];//车辆用途
    [self.carUse setFrame:CGRectMake(366, 236, 158, 28)];
    [self.carUse setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.carUse addTarget:self action:@selector(carUse:) forControlEvents:UIControlEventTouchUpInside];
    if([[self.carModifyDataDit objectForKey:@"carUse"]isEqualToString:@"1"])
    {
        [self.carUse setTitle:@"上下班" forState:UIControlStateNormal];
    }
    if([[self.carModifyDataDit objectForKey:@"carUse"]isEqualToString:@"2"])
    {
        [self.carUse setTitle:@"公事" forState:UIControlStateNormal];
    }
    if([[self.carModifyDataDit objectForKey:@"carUse"]isEqualToString:@"3"])
    {
        [self.carUse setTitle:@"休闲" forState:UIControlStateNormal];
    }
    if([[self.carModifyDataDit objectForKey:@"carUse"]isEqualToString:@"0"])
    {
        [self.carUse setTitle:@"其他" forState:UIControlStateNormal];
    }
    self.carUse.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.carUse setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.carUse];
    
    self.baoxiangongsi = [[UILabel alloc]initWithFrame:CGRectMake(675, 53, 160, 30)];     //保险公司
    [self.baoxiangongsi setBackgroundColor:[UIColor clearColor]];
    self.baoxiangongsi.layer.borderColor = [[UIColor grayColor]CGColor];
    self.baoxiangongsi.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:self.baoxiangongsi];
    
    self.baoxiangoumai = [[UILabel alloc]initWithFrame:CGRectMake(675, 97, 160, 30)];   //保险购买日期
    [self.baoxiangoumai setBackgroundColor:[UIColor clearColor]];
    self.baoxiangoumai.layer.borderColor = [[UIColor grayColor]CGColor];
    self.baoxiangoumai.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:self.baoxiangoumai];
    
    self.baoxiandaoqi = [[UILabel alloc]initWithFrame:CGRectMake(675, 141, 160, 30)];   //保险到期日期
    [self.baoxiandaoqi setBackgroundColor:[UIColor clearColor]];
    self.baoxiandaoqi.layer.borderColor = [[UIColor grayColor]CGColor];
    self.baoxiandaoqi.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:self.baoxiandaoqi];
    
    UILabel *label8 = [[UILabel alloc]initWithFrame:CGRectMake(675, 187, 160, 30)];   //年检开始日期
    [label8 setBackgroundColor:[UIColor clearColor]];
    label8.layer.borderColor = [[UIColor grayColor]CGColor];
    label8.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label8];
    self.checkStartDate = [UIButton buttonWithType:UIButtonTypeCustom];//年检开始日期
    [self.checkStartDate setFrame:CGRectMake(676, 188, 158, 28)];
    [self.checkStartDate setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.checkStartDate addTarget:self action:@selector(checkStartDate:) forControlEvents:UIControlEventTouchUpInside];
    [self.checkStartDate setTitle:[self.carModifyDataDit objectForKey:@"yearCheckStartDate"] forState:UIControlStateNormal];
    self.checkStartDate.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.checkStartDate setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.checkStartDate];
    
    UILabel *label9 = [[UILabel alloc]initWithFrame:CGRectMake(675, 235, 160, 30)];   //购买日期
    [label9 setBackgroundColor:[UIColor clearColor]];
    label9.layer.borderColor = [[UIColor grayColor]CGColor];
    label9.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label9];
    self.buyDate = [UIButton buttonWithType:UIButtonTypeCustom];  //购买日期
    [self.buyDate setFrame:CGRectMake(676, 236, 158, 28)];
    [self.buyDate setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.buyDate addTarget:self action:@selector(buyDate:) forControlEvents:UIControlEventTouchUpInside];
    [self.buyDate setTitle:[self.carModifyDataDit objectForKey:@"buyDate"] forState:UIControlStateNormal];
    self.buyDate.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.buyDate setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.buyDate];
    
    
    UILabel *label10 = [[UILabel alloc]initWithFrame:CGRectMake(675, 279, 160, 30)];   //上牌日期
    [label10 setBackgroundColor:[UIColor clearColor]];
    label10.layer.borderColor = [[UIColor grayColor]CGColor];
    label10.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label10];
    self.registrationDate = [UIButton buttonWithType:UIButtonTypeCustom]; //上牌日期
    [self.registrationDate setFrame:CGRectMake(676, 280, 158, 28)];
    [self.registrationDate setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.registrationDate addTarget:self action:@selector(registrationDate:) forControlEvents:UIControlEventTouchUpInside];
    [self.registrationDate setTitle:[self.carModifyDataDit objectForKey:@"plateDate"] forState:UIControlStateNormal];
    self.registrationDate.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.registrationDate setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.registrationDate];
    
    UILabel *label11 = [[UILabel alloc]initWithFrame:CGRectMake(675, 324, 160, 30)];   //第一次来厂日期
    [label11 setBackgroundColor:[UIColor clearColor]];
    label11.layer.borderColor = [[UIColor grayColor]CGColor];
    label11.layer.borderWidth = 0.8;
    [self.backgroundView addSubview:label11];
    self.firstTimeDate = [UIButton buttonWithType:UIButtonTypeCustom];//第一次来厂日期
    [self.firstTimeDate setFrame:CGRectMake(676, 325, 158, 28)];
    [self.firstTimeDate setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.firstTimeDate addTarget:self action:@selector(firstTimeDate:) forControlEvents:UIControlEventTouchUpInside];
    [self.firstTimeDate setTitle:[self.carModifyDataDit objectForKey:@"firstComingDate"] forState:UIControlStateNormal];
    self.firstTimeDate.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.firstTimeDate setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.backgroundView addSubview:self.firstTimeDate];
    
    self.lastComingMileage = [[UITextField alloc]initWithFrame:CGRectMake(675, 368, 160, 30)];  //最后一次来厂里程
    self.lastComingMileage.borderStyle = UITextBorderStyleLine;
    self.lastComingMileage.textColor = [UIColor grayColor];
    self.lastComingMileage.font = [UIFont fontWithName:@"ArialMT" size:15];
    self.lastComingMileage.text = [self.carModifyDataDit objectForKey:@"lastComingMileage"];
    [self.lastComingMileage setTextAlignment:NSTextAlignmentCenter];
    self.lastComingMileage.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.lastComingMileage.delegate = self;
    [self.backgroundView addSubview:self.lastComingMileage];

#pragma mark - 是否保修车辆选择按钮
    self.WarrantyOptions = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.WarrantyOptions setFrame:CGRectMake(325, 320, 35, 36)];
    [self.WarrantyOptions setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
    [self.WarrantyOptions addTarget:self action:@selector(WarrantyOptions:) forControlEvents:UIControlEventTouchUpInside];
    [self.backgroundView addSubview:self.WarrantyOptions];
}
#pragma mark - 年检开始日期的回调
-(void)checkStartDate:(id)sender
{
    self.datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 0, 280, 160)];
    self.datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:NSLocalizedString(@"Chinese", @"")];
    self.datePicker.datePickerMode = UIDatePickerModeDate;
    
    [self.datePicker addTarget:self action:@selector(dateChanged:) forControlEvents:UIControlEventValueChanged];
    //
    panleCon = [[UIViewController alloc] init];
    [panleCon.view addSubview:self.datePicker];
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:panleCon];
    self.popCon.popoverContentSize = CGSizeMake(280.0f, 160.0f);
    
    [self.popCon presentPopoverFromRect:CGRectMake(70, 0, 5, 30) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)dateChanged:(id)sender
{
    UIDatePicker *contro = (UIDatePicker*)sender;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *str = [formatter stringFromDate:contro.date];
    [self.checkStartDate setTitle:str forState:UIControlStateNormal];
}
#pragma mark - 购买日期的回调
-(void)buyDate:(id)sender
{
    self.datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 0, 280, 160)];
    self.datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:NSLocalizedString(@"Chinese", @"")];
    self.datePicker.datePickerMode = UIDatePickerModeDate;
    
    [self.datePicker addTarget:self action:@selector(dateChanged1:) forControlEvents:UIControlEventValueChanged];
    //
    panleCon = [[UIViewController alloc] init];
    [panleCon.view addSubview:self.datePicker];
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:panleCon];
    self.popCon.popoverContentSize = CGSizeMake(280.0f, 160.0f);
    
    [self.popCon presentPopoverFromRect:CGRectMake(70, 0, 5, 30) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)dateChanged1:(id)sender
{
    UIDatePicker *contro = (UIDatePicker*)sender;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *str = [formatter stringFromDate:contro.date];
    [self.buyDate setTitle:str forState:UIControlStateNormal];
}
#pragma mark - 上牌日期的回调
-(void)registrationDate:(id)sender
{
    self.datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 0, 280, 160)];
    self.datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:NSLocalizedString(@"Chinese", @"")];
    self.datePicker.datePickerMode = UIDatePickerModeDate;
    
    [self.datePicker addTarget:self action:@selector(dateChanged2:) forControlEvents:UIControlEventValueChanged];
    //
    panleCon = [[UIViewController alloc] init];
    [panleCon.view addSubview:self.datePicker];
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:panleCon];
    self.popCon.popoverContentSize = CGSizeMake(280.0f, 160.0f);
    
    [self.popCon presentPopoverFromRect:CGRectMake(70, 0, 5, 30) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)dateChanged2:(id)sender
{
    UIDatePicker *contro = (UIDatePicker*)sender;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *str = [formatter stringFromDate:contro.date];
    [self.registrationDate setTitle:str forState:UIControlStateNormal];
}
#pragma mark - 第一次来厂日期的回调
-(void)firstTimeDate:(id)sender
{
    self.datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 0, 280, 160)];
    self.datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:NSLocalizedString(@"Chinese", @"")];
    self.datePicker.datePickerMode = UIDatePickerModeDate;
    
    [self.datePicker addTarget:self action:@selector(dateChanged3:) forControlEvents:UIControlEventValueChanged];
    //
    panleCon = [[UIViewController alloc] init];
    [panleCon.view addSubview:self.datePicker];
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:panleCon];
    self.popCon.popoverContentSize = CGSizeMake(280.0f, 160.0f);
    
    [self.popCon presentPopoverFromRect:CGRectMake(70, 0, 5, 30) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)dateChanged3:(id)sender
{
    UIDatePicker *contro = (UIDatePicker*)sender;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *str = [formatter stringFromDate:contro.date];
    [self.firstTimeDate setTitle:str forState:UIControlStateNormal];
}

#pragma mark - 弹出窗口
-(void)popViewPicture
{
    self.keHuPopView = [[UIView alloc]initWithFrame:CGRectMake(60, 768, 1024-60-60, 768)];
    [self.keHuPopView setBackgroundColor:[UIColor whiteColor]];
    //    [self.backgroundView addSubview:self.keHuPopView];
    
    self.queryNumberField = [[UITextField alloc]initWithFrame:CGRectMake(110, 150, 160, 30)];  //查询编号
    self.queryNumberField.borderStyle = UITextBorderStyleLine;
    self.queryNumberField.textColor = [UIColor grayColor];
    self.queryNumberField.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.keHuPopView addSubview:self.queryNumberField];
    
    self.queryNameField = [[UITextField alloc]initWithFrame:CGRectMake(415, 150, 240, 30)];  //查询名称
    self.queryNameField.borderStyle = UITextBorderStyleLine;
    self.queryNameField.textColor = [UIColor grayColor];
    self.queryNameField.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.keHuPopView addSubview:self.queryNameField];
    
    self.queryButton = [[UIButton alloc]initWithFrame:CGRectMake(680, 145, 75, 36)];
    [self.queryButton setBackgroundImage:[UIImage imageNamed:@"ht05-1.png"] forState:UIControlStateNormal];
    [self.queryButton setTitle:@"查 询" forState:UIControlStateNormal];
    [self.queryButton setTintColor:[UIColor whiteColor]];
    self.queryButton.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.queryButton addTarget:self action:@selector(queryButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.keHuPopView addSubview:self.queryButton];
    
    UILabel *bianhao = [[UILabel alloc]initWithFrame:CGRectMake(30, 150, 80, 30)];
    bianhao.text = @"客户编号:";
    bianhao.backgroundColor = [UIColor clearColor];
    bianhao.textColor = [UIColor grayColor];
    bianhao.font = [UIFont fontWithName:@"ArialMT" size:16];
    [self.keHuPopView addSubview:bianhao];
    
    UILabel *mingchen = [[UILabel alloc]initWithFrame:CGRectMake(330, 150, 80, 30)];
    mingchen.text = @"客户名称:";
    mingchen.backgroundColor = [UIColor clearColor];
    mingchen.textColor = [UIColor grayColor];
    mingchen.font = [UIFont fontWithName:@"ArialMT" size:16];
    [self.keHuPopView addSubview:mingchen];
    
    UILabel *delegate = [[UILabel alloc]initWithFrame:CGRectMake(520, 205, 80, 30)];
    delegate.text = @"协议客户";
    delegate.backgroundColor = [UIColor clearColor];
    delegate.textColor = [UIColor grayColor];
    delegate.font = [UIFont fontWithName:@"ArialMT" size:16];
    [self.keHuPopView addSubview:delegate];
    
    UILabel *puTong = [[UILabel alloc]initWithFrame:CGRectMake(720, 205, 80, 30)];
    puTong.text = @"普通客户";
    puTong.backgroundColor = [UIColor clearColor];
    puTong.textColor = [UIColor grayColor];
    puTong.font = [UIFont fontWithName:@"ArialMT" size:16];
    [self.keHuPopView addSubview:puTong];
    //是否普通客户
    self.customerTypeXy = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.customerTypeXy setFrame:CGRectMake(600, 200, 35, 36)];
    [self.customerTypeXy setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
    [self.customerTypeXy addTarget:self action:@selector(customerTypeXy:) forControlEvents:UIControlEventTouchUpInside];
    [self.keHuPopView addSubview:self.customerTypeXy];
    //是否协议客户
    self.customerTypePt = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.customerTypePt setFrame:CGRectMake(800, 200, 35, 36)];
    [self.customerTypePt setImage:[UIImage imageNamed:@"对号.png"] forState:UIControlStateNormal];
    [self.customerTypePt addTarget:self action:@selector(customerTypePt:) forControlEvents:UIControlEventTouchUpInside];
    [self.keHuPopView addSubview:self.customerTypePt];
    
    UILabel *dizhi = [[UILabel alloc]initWithFrame:CGRectMake(710, 250, 185, 40)];
    dizhi.text = @"联系地址";
    [dizhi setBackgroundColor:[[UIColor alloc]initWithRed:240.00/255 green:240.00/255 blue:240.00/255 alpha:1]];
    dizhi.textColor = [UIColor grayColor];
    dizhi.font = [UIFont fontWithName:@"ArialMT" size:15];
    [dizhi setTextAlignment:NSTextAlignmentCenter];
    [self.keHuPopView addSubview:dizhi];
    
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [backButton setImage:[UIImage imageNamed:@"返回下.png"] forState:UIControlStateNormal];
    [backButton setFrame:CGRectMake(20, 48, 65, 40)];
    [backButton addTarget:self action:@selector(chaxunbalck:) forControlEvents:UIControlEventTouchUpInside];
    [self.keHuPopView addSubview:backButton];
    
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(0, 105, 980, 11)];
    image.image = [UIImage imageNamed:@"渐变分割线.png"];
    [self.keHuPopView addSubview:image];
    UILabel *imagetitel = [[UILabel alloc]initWithFrame:CGRectMake(110, 55, 180, 35)];
    imagetitel.text = @"客户信息查询";
    imagetitel.backgroundColor = [UIColor clearColor];
    imagetitel.textColor = [UIColor grayColor];
    imagetitel.font = [UIFont fontWithName:@"ArialMT" size:28];
    [self.keHuPopView addSubview:imagetitel];
    
    NSMutableArray *labelMutabelArrayOne = [[NSMutableArray alloc]initWithObjects:@"客户编号",@"客户名称",@"固定电话",@"联系人",@"手机",@"地区",@"传真", nil];
    for(int i = 0; i < 7;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake((0+i*100), 250, 110, 40)];
        [titlelabel setBackgroundColor:[[UIColor alloc]initWithRed:240.00/255 green:240.00/255 blue:240.00/255 alpha:1]];
        titlelabel.text = [labelMutabelArrayOne objectAtIndex:i];
        [titlelabel setTextColor:[UIColor grayColor]];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:15];
        [titlelabel setTextAlignment:NSTextAlignmentCenter];
        [self.keHuPopView addSubview:titlelabel];
    }
    self.queryTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 290, 895, 280) style:UITableViewStylePlain];
    [self.queryTableView setDataSource:self];
    [self.queryTableView setDelegate:self];
    [self.keHuPopView addSubview:self.queryTableView];
}
#pragma mark - 是否协议客户按钮的回调
-(void)customerTypeXy:(id)sender
{
    _TypePt = NO;
    if(_TypeXy == NO)
    {
        [self.customerTypeXy setImage:[UIImage imageNamed:@"对号.png"] forState:UIControlStateNormal];
        [self.customerTypePt setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
        _TypeXy = YES;
    }
    else
    {
        _TypeXy = NO;
        [self.customerTypeXy setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
    }
}
#pragma mark - 是否普通客户按钮的回调
-(void)customerTypePt:(id)sender
{
    _TypeXy = NO;
    if(_TypePt == NO)
    {
        [self.customerTypePt setImage:[UIImage imageNamed:@"对号.png"] forState:UIControlStateNormal];
        [self.customerTypeXy setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
        _TypePt = YES;
    }
    else
    {
        _TypePt = NO;
        [self.customerTypePt setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
    }
}
#pragma mark - 弹出窗查询按钮的回调
-(void)queryButton:(id)sender
{
    [SVProgressHUD showWithStatus:@"请等待...."];
    webService *web = [[webService alloc]init];
    web.methodName = SEARCHCUSTOMERLIST;
    NSMutableArray *queryArray = [[NSMutableArray alloc]init];
    
   
    
    
    if(self.queryNumberField.text != nil)
    {
        [queryArray addObject:@"customerId"];
        [queryArray addObject:self.queryNumberField.text];
    }
    if(self.queryNameField.text != nil)
    {
        [queryArray addObject:@"customerName"];
        [queryArray addObject:self.queryNameField.text];
    }
    if(_TypeXy == YES)
    {
        [queryArray addObject:@"customerType"];
        [queryArray addObject:@"1"];
    }
    if(_TypePt == YES)
    {
        [queryArray addObject:@"customerType"];
        [queryArray addObject:@"0"];
    }

    [web commonGetSharedRequest:SEARCHCUSTOMERLIST wsparas:queryArray];
}
-(void)searchCustomerList:(NSNotification *)notification
{
    NSMutableDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData *)notification.object options:NSJSONReadingMutableLeaves error:Nil];
    self.queryDataArray = [NSMutableArray arrayWithArray:[theJson objectForKey:@"customerList"]];
    [self.queryTableView reloadData];
    [SVProgressHUD dismiss];
}
-(void)chaxunbalck:(id)sender
{
    [UIView animateWithDuration:0.5 animations:^{
        [self.keHuPopView setFrame:CGRectMake(0, 768, 1024, 768)];
    }completion:^(BOOL finished) {
        [self.keHuPopView setHidden:YES];
    }];
}
#pragma mark - 各种输入框
-(void)Avarietyoftextfield
{
    self.warrantyNumber = [[UITextField alloc]initWithFrame:CGRectMake(365, 279, 160, 30)];  //保修序号
    self.warrantyNumber.borderStyle = UITextBorderStyleLine;
    self.warrantyNumber.textColor = [UIColor grayColor];
    self.warrantyNumber.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.warrantyNumber.text = @"";
    [self.warrantyNumber setTextAlignment:NSTextAlignmentCenter];
    self.warrantyNumber.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.backgroundView addSubview:self.warrantyNumber];
    
    self.monthsOfNumber = [[UILabel alloc]initWithFrame:CGRectMake(365, 368, 160, 30)];  //保修月数
    self.monthsOfNumber.layer.borderColor = [[UIColor grayColor]CGColor];
    self.monthsOfNumber.layer.borderWidth = 1.0;
    self.monthsOfNumber.textColor = [UIColor grayColor];
    [self.monthsOfNumber setHidden:NO];
    self.monthsOfNumber.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.monthsOfNumber.text = [self.carModifyDataDit objectForKey:@"WarrantyMonths"];
    [self.monthsOfNumber setTextAlignment:NSTextAlignmentCenter];
    [self.backgroundView addSubview:self.monthsOfNumber];
    
    self.layerLabel = [[UILabel alloc]initWithFrame:CGRectMake(365, 368, 160, 30)];   //保修到期日
    [self.layerLabel setBackgroundColor:[UIColor clearColor]];
    self.layerLabel.layer.borderColor = [[UIColor grayColor]CGColor];
    self.layerLabel.layer.borderWidth = 0.8;
    [self.layerLabel setHidden:YES];
    [self.backgroundView addSubview:self.layerLabel];
    self.baoXiuDaoQiRi = [UIButton buttonWithType:UIButtonTypeCustom];//保修到期日
    [self.baoXiuDaoQiRi setFrame:CGRectMake(366, 369, 158, 28)];
    [self.baoXiuDaoQiRi setBackgroundImage:[UIImage imageNamed:@"下拉框.png"] forState:UIControlStateNormal];
    [self.baoXiuDaoQiRi addTarget:self action:@selector(baoXiuDaoQiRi:) forControlEvents:UIControlEventTouchUpInside];
    [self.baoXiuDaoQiRi setTitle:@"请选择" forState:UIControlStateNormal];
    self.baoXiuDaoQiRi.titleLabel.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.baoXiuDaoQiRi setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [self.baoXiuDaoQiRi setHidden:YES];
    [self.backgroundView addSubview:self.baoXiuDaoQiRi];
    
    self.licenseplate = [[UITextField alloc]initWithFrame:CGRectMake(100, 141, 160, 30)];  //车牌号
    self.licenseplate.borderStyle = UITextBorderStyleLine;
    self.licenseplate.textColor = [UIColor grayColor];
    self.licenseplate.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.licenseplate.text = [self.carModifyDataDit objectForKey:@"plateNumber"];
    [self.licenseplate setTextAlignment:NSTextAlignmentCenter];
    self.licenseplate.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.licenseplate.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
    [self.backgroundView addSubview:self.licenseplate];
    
    self.carframe = [[UITextField alloc]initWithFrame:CGRectMake(100, 53, 160, 30)];    //车架号
    self.carframe.borderStyle = UITextBorderStyleLine;
    self.carframe.autocapitalizationType=UITextAutocapitalizationTypeAllCharacters;
    self.carframe.textColor = [UIColor grayColor];
    self.carframe.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.carframe.text = [self.carModifyDataDit objectForKey:@"vin"];
    [self.carframe setTextAlignment:NSTextAlignmentCenter];
    self.carframe.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.carframe.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
    [self.backgroundView addSubview:self.carframe];
    ////////年款/////////////////
    self.Inparagraph = [[UITextField alloc]initWithFrame:CGRectMake(100, 324, 160, 30)];    //年款
    self.Inparagraph.borderStyle = UITextBorderStyleLine;
    self.Inparagraph.textColor = [UIColor grayColor];
    self.Inparagraph.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.Inparagraph.text = [self.carModifyDataDit objectForKey:@"year"];
    [self.Inparagraph setTextAlignment:NSTextAlignmentCenter];
    self.Inparagraph.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.Inparagraph.delegate = self;
    [self.backgroundView addSubview:self.Inparagraph];
    
    
    
    
    
    self.exhaust = [[UITextField alloc]initWithFrame:CGRectMake(100, 368, 160, 30)];      //排气量
    self.exhaust.borderStyle = UITextBorderStyleLine;
    self.exhaust.textColor = [UIColor grayColor];
    self.exhaust.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.exhaust.text = [self.carModifyDataDit objectForKey:@"emission"];
    [self.exhaust setTextAlignment:NSTextAlignmentCenter];
    self.exhaust.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.exhaust.delegate = self;
    [self.backgroundView addSubview:self.exhaust];
    
    self.keyNumber = [[UITextField alloc]initWithFrame:CGRectMake(365, 141, 160, 30)];      //钥匙号
    self.keyNumber.borderStyle = UITextBorderStyleLine;
    self.keyNumber.textColor = [UIColor grayColor];
    self.keyNumber.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.keyNumber.text = [self.carModifyDataDit objectForKey:@"keyNumber"];
    [self.keyNumber setTextAlignment:NSTextAlignmentCenter];
    self.keyNumber.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.backgroundView addSubview:self.keyNumber];
    
    self.liChenShuRu = [[UITextField alloc]initWithFrame:CGRectMake(365, 412, 160, 30)];      //保修里程
    self.liChenShuRu.borderStyle = UITextBorderStyleLine;
    self.liChenShuRu.textColor = [UIColor grayColor];
    self.liChenShuRu.font = [UIFont fontWithName:@"ArialMT" size:14];
    self.liChenShuRu.text = [self.carModifyDataDit objectForKey:@"WarrantyMileage"];
    [self.liChenShuRu setTextAlignment:NSTextAlignmentCenter];
    self.liChenShuRu.contentVerticalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self.liChenShuRu setHidden:YES];
    [self.backgroundView addSubview:self.liChenShuRu];
}
#pragma mark - 读取大字典
-(NSMutableDictionary *)readershuDICimform
{
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *path=[paths objectAtIndex:0];
    NSString *str=[path stringByAppendingPathComponent:@"Dic.text"];
    dic=[NSMutableDictionary dictionaryWithContentsOfFile:str];
    //nslog(@"%@",dic);
    return dic;
}
#pragma mark - 车主选择按钮的回调
-(void)carMasterButton:(id)sender
{
    _currentButton = self.carMasterButton;
    [self popViewPicture];

    [self.view addSubview:self.keHuPopView];
    [UIView animateWithDuration:0.5 animations:^{
        [self.keHuPopView setFrame:CGRectMake(60, 0, 1024-60-60, 768)];
    }completion:^(BOOL finished) {
        
    }];
}
#pragma mark - 使用者按钮的回调
-(void)carUserButton:(id)sender
{
    _currentButton = self.carUserButton;
    [self popViewPicture];
    
    [self.view addSubview:self.keHuPopView];
    [UIView animateWithDuration:0.5 animations:^{
        [self.keHuPopView setFrame:CGRectMake(60, 0, 1024-60-60, 768)];
    }completion:^(BOOL finished) {
        
    }];
}
#pragma mark - 驾驶员按钮的回调
-(void)carDrivingButton:(id)sender
{
    _currentButton = self.carDrivingButton;
    [self popViewPicture];
    
    [self.view addSubview:self.keHuPopView];
    [UIView animateWithDuration:0.5 animations:^{
        [self.keHuPopView setFrame:CGRectMake(60, 0, 1024-60-60, 768)];
    }completion:^(BOOL finished) {
        
    }];
}
#pragma mark - 是否保修车辆选择按钮的回调
-(void)WarrantyOptions:(id)sender
{
    if(_warrantyChoose == YES)
    {
        _warrantyChoose = NO;
        [self.WarrantyOptions setImage:[UIImage imageNamed:@"对号框.png"] forState:UIControlStateNormal];
        [self.monthsOfNumber setHidden:NO];
        [self.layerLabel setHidden:YES];
        [self.baoXiuDaoQiRi setHidden:YES];
        self.baoXiuDaoQi.text = @"   保修月数:";
        [self.baoXiuLiChen setHidden:YES];
        [self.liChenShuRu setHidden:YES];
    }
    else
    {
        _warrantyChoose = YES;
        [self.WarrantyOptions setImage:[UIImage imageNamed:@"对号.png"] forState:UIControlStateNormal];
        [self.monthsOfNumber setHidden:YES];
        [self.layerLabel setHidden:NO];
        [self.baoXiuDaoQiRi setHidden:NO];
        self.baoXiuDaoQi.text = @"保修到期日:";
        [self.baoXiuLiChen setHidden:NO];
        [self.liChenShuRu setHidden:NO];
    }
}
#pragma mark - 各种下拉菜单的回调
//**** 生产厂家
-(void)manufacturer:(id)sender
{
    webService *webcon = [[webService alloc]init];
    webcon.methodName = GETMANUFACTURELIST;
    [webcon commonGetSharedRequest:GETMANUFACTURELIST wsparas:nil];
    
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.manufacturer.frame.size.width, 160)];
    [self.popCon presentPopoverFromRect:CGRectMake(12, 10, 135, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)getManufactureList:(NSNotification*)notification{
    
    NSDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData*)notification.object options:NSJSONReadingMutableLeaves error:Nil];
    self.manufacturerArray = [theJson objectForKey:@"manufactureList"];
    NSMutableArray *carTypeArray=[[NSMutableArray alloc] init];
    
    for (int i=0; i<[[theJson objectForKey:@"manufactureList"] count]; i++) {
        
        [carTypeArray addObject: [[[theJson objectForKey:@"manufactureList"] objectAtIndex:i] objectForKey:@"manufactureName"]];
    }
    contentCon.list = carTypeArray;
    [contentCon.myTableView reloadData];
}

//**** 车型
-(void)model:(id)sender
{
    webService *web=[[webService alloc] init];
    web.methodName = GETCARTYPENAMELIST;
    [web commonGetSharedRequest:GETCARTYPENAMELIST wsparas:nil];
    
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.model.frame.size.width, 160)];
    [self.popCon presentPopoverFromRect:CGRectMake(12, 10, 135, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)getCarType:(NSNotification*)notification{
    
    NSDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData*)notification.object options:NSJSONReadingMutableLeaves error:Nil];
    self.carTypeArray = [theJson objectForKey:@"results"];
    NSMutableArray *carTypeArray=[[NSMutableArray alloc] init];
    
    for (int i=0; i<[[theJson objectForKey:@"results"] count]; i++) {
        
        [carTypeArray addObject: [[[theJson objectForKey:@"results"] objectAtIndex:i] objectForKey:@"carTypeName"]];
    }
    contentCon.list = carTypeArray;
    [contentCon.myTableView reloadData];
}

//**** 国家代码
-(void)countriesCodeName:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.countriesCodeName.frame.size.width, 80)];
    [self.popCon presentPopoverFromRect:CGRectMake(12, 10, 135, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    NSMutableArray *carTypeArray=[[NSMutableArray alloc] init];
    [carTypeArray addObject:@"中国"];
    [carTypeArray addObject:@"日本"];
    
    contentCon.list = carTypeArray;
    [contentCon.myTableView reloadData];
}
//**** 车辆用途
-(void)carUse:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.carUse.frame.size.width, 160)];
    [self.popCon presentPopoverFromRect:CGRectMake(12, 10, 135, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
//    NSMutableArray *use=[[NSMutableArray alloc] init];
//    [use addObject:@"上下班"];
//    [use addObject:@"公事"];
//    [use addObject:@"休闲"];
//    [use addObject:@"其他"];
//    
//    contentCon.list = use;
    [contentCon.myTableView reloadData];
}

//**** 变速箱类型
-(void)transmissionType:(id)sender
{
    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.transmissionType.frame.size.width, 200)];
    [self.popCon presentPopoverFromRect:CGRectMake(12, 10, 135, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    NSMutableArray *carTypeArray=[[NSMutableArray alloc] init];
    [carTypeArray addObject:@"5AT"];
    [carTypeArray addObject:@"5MT"];
    [carTypeArray addObject:@"AT"];
    [carTypeArray addObject:@"CVT"];
    [carTypeArray addObject:@"MT"];
    
    contentCon.list = carTypeArray;
    [contentCon.myTableView reloadData];
}
//**** 内装颜色
-(void)insideColor:(id)sender
{
//    webService *web=[[webService alloc] init];
//    web.methodName = GETCARINNERCOLORLIST;
//    [web commonGetSharedRequest:GETCARINNERCOLORLIST wsparas:nil];

    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.insideColor.frame.size.width, 160)];
    [self.popCon presentPopoverFromRect:CGRectMake(12, 10, 135, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
    
    
}
-(void)getCarInnerColorList:(NSNotification*)notification{
    
    NSDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData*)notification.object options:NSJSONReadingMutableLeaves error:Nil];
    self.carInerColorArray = [theJson objectForKey:@"results"];
    NSMutableArray *carInerColorArray=[[NSMutableArray alloc] init];
    
    for (int i=0; i<[[theJson objectForKey:@"results"] count]; i++) {
        
        [carInerColorArray addObject: [[[theJson objectForKey:@"results"] objectAtIndex:i] objectForKey:@"carInerColorName"]];
    }
    contentCon.list = carInerColorArray;
    [contentCon.myTableView reloadData];
}

//**** 车辆颜色
-(void)carClolr:(id)sender
{
    webService *web=[[webService alloc] init];
    web.methodName = GETCARCOLORLIST;
    [web commonGetSharedRequest:GETCARCOLORLIST wsparas:nil];

    if (!contentCon) {
        contentCon=[[popContentViewController alloc] initWithNibName:@"popContentViewController" bundle:nil];
    }
    contentCon.delegate = self;
    contentCon.btnSender=sender;
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:contentCon];
    [DDPopoverBackgroundView setTintColor:[UIColor colorWithRed:234 green:248 blue:242 alpha:0.9]];
    [DDPopoverBackgroundView setArrowBase:30.0];//箭头
    [DDPopoverBackgroundView setArrowHeight:15.0];
    [DDPopoverBackgroundView setContentInset:1.0];
    [self.popCon setPopoverBackgroundViewClass:[DDPopoverBackgroundView class]];
    [self.popCon setPopoverContentSize:CGSizeMake(self.carClolr.frame.size.width, 160)];
    [self.popCon presentPopoverFromRect:CGRectMake(12, 10, 135, 20) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)getcarColorList:(NSNotification*)notification{
    
    NSDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData*)notification.object options:NSJSONReadingMutableLeaves error:Nil];
    self.carColorArray = [theJson objectForKey:@"results"];
    NSMutableArray *carColorArray=[[NSMutableArray alloc] init];
    
    for (int i=0; i<[[theJson objectForKey:@"results"] count]; i++) {
        
        [carColorArray addObject: [[[theJson objectForKey:@"results"] objectAtIndex:i] objectForKey:@"carColorName"]];
    }
    contentCon.list = carColorArray;
    [contentCon.myTableView reloadData];
}

//**** 保修到期日
-(void)baoXiuDaoQiRi:(id)sender
{
    self.datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 0, 280, 160)];
    self.datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:NSLocalizedString(@"Chinese", @"")];
    self.datePicker.datePickerMode = UIDatePickerModeDate;
    
    [self.datePicker addTarget:self action:@selector(dateChanged5:) forControlEvents:UIControlEventValueChanged];
    //
    panleCon = [[UIViewController alloc] init];
    [panleCon.view addSubview:self.datePicker];
    self.popCon = [[UIPopoverController alloc] initWithContentViewController:panleCon];
    self.popCon.popoverContentSize = CGSizeMake(280.0f, 160.0f);
    
    [self.popCon presentPopoverFromRect:CGRectMake(70, 0, 5, 30) inView:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)dateChanged5:(id)sender
{
    UIDatePicker *contro = (UIDatePicker*)sender;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"yyyy-MM-dd"];
    NSString *str = [formatter stringFromDate:contro.date];
    [self.baoXiuDaoQiRi setTitle:str forState:UIControlStateNormal];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if(tableView == self.queryTableView)
    {
        return [self.queryDataArray count];
    }
    if(tableView == self.subNewTableView)
    {
        return [self.CarModifyDataArray count];
    }
    return 0;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   
    if(tableView == self.queryTableView)
    {
//        self.queryRowData = [self.queryDataArray objectAtIndex:[indexPath row]];
        self.queryRowData = [NSMutableDictionary dictionaryWithDictionary:[self.queryDataArray objectAtIndex:[indexPath row]]];
//        NSLog(@"%@",self.queryRowData);
        
     
        if(_currentButton == self.carMasterButton)
        {
            self.CarModifyDataArray = [NSMutableArray arrayWithArray:self.CarModifyDataArray];
            [self.queryRowData setObject:@"车主" forKey:@"customerRole"];
            [self.CarModifyDataArray setObject:self.queryRowData atIndexedSubscript:0];
            
            [self.subNewTableView reloadData];
            [UIView animateWithDuration:0.5 animations:^{
                [self.keHuPopView setFrame:CGRectMake(0, 768, 1024, 768)];
            }completion:^(BOOL finished) {
                [self.keHuPopView setHidden:YES];
            }];
        }
        if(_currentButton == self.carUserButton)
        {
            self.CarModifyDataArray = [NSMutableArray arrayWithArray:self.CarModifyDataArray];
            [self.queryRowData setObject:@"驾驶员" forKey:@"customerRole"];
            [self.CarModifyDataArray setObject:self.queryRowData atIndexedSubscript:1];
            [self.subNewTableView reloadData];
            [UIView animateWithDuration:0.5 animations:^{
                [self.keHuPopView setFrame:CGRectMake(0, 768, 1024, 768)];
            }completion:^(BOOL finished) {
                [self.keHuPopView setHidden:YES];
            }];
        }
        if(_currentButton == self.carDrivingButton)
        {
            self.CarModifyDataArray = [NSMutableArray arrayWithArray:self.CarModifyDataArray];
            [self.queryRowData setObject:@"使用者" forKey:@"customerRole"];
            [self.CarModifyDataArray setObject:self.queryRowData atIndexedSubscript:2];
            [self.subNewTableView reloadData];
            [UIView animateWithDuration:0.5 animations:^{
                [self.keHuPopView setFrame:CGRectMake(0, 768, 1024, 768)];
            }completion:^(BOOL finished) {
                [self.keHuPopView setHidden:YES];
            }];
        }
       
    }
    if(tableView == self.subNewTableView)
    {
        webService *webcon = [[webService alloc]init];
        webcon.methodName = GETREPAIRCUSTOMERDETAIL;
        NSMutableArray *arry = [NSMutableArray arrayWithObjects:@"customerId",[[self.CarModifyDataArray objectAtIndex:indexPath.row] objectForKey:@"customerId"],nil];
        
        [webcon commonGetSharedRequest:GETREPAIRCUSTOMERDETAIL wsparas:arry];
        [SVProgressHUD showWithStatus:@"请等待...."];
    }
    
}
-(void)ownerDetail:(NSNotification *)notification
{
    NSMutableDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData *)notification.object options:NSJSONReadingMutableLeaves error:nil];
    self.customerInsideViewController = [[CustomerInsideViewController alloc] init];
    self.customerInsideViewController.customerInsideDit = theJson;
    self.customerInsideViewController.douBiZhaoshaofei = @"";
//    NSMusicDirectory *caoNiLaoLaoZhaoShaoFei = [NSMutableDictionary dictionaryWithDictionary:theJson];
    [self.navigationController pushViewController:self.customerInsideViewController animated:YES];
    [SVProgressHUD dismiss];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSInteger row = [indexPath row];
    if(tableView == self.subNewTableView)
    {
        static NSString *indetfire = @"cell";
        CarCustomerInKeHuCell *cell = (CarCustomerInKeHuCell *)[tableView dequeueReusableCellWithIdentifier:indetfire];
        if(nil == cell)
        {
            cell = [[CarCustomerInKeHuCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indetfire];
            tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        }
        cell.cellLabelTwo.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"customerId"];
        cell.cellLabelThree.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"customerName"];
        if ([[[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"natureName"] isEqual:@"C1"]) {
            cell.cellLabelFour.text=@"政府机关";
        }else if ([[[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"natureName"] isEqual:@"C2"]){
            cell.cellLabelFour.text=@"企事业单位";
        }else if ([[[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"natureName"] isEqual:@"C3"]){
            cell.cellLabelFour.text=@"私人";
        }
        //cell.cellLabelFour.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"natureName"];
        cell.cellLabelFive.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"mobile"];
        cell.cellLabelSix.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"tel"];
        cell.cellLabelSeven.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"fax"];
        cell.cellLabelEight.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"address"];
        
        return cell;
    }
    if(tableView == self.queryTableView)
    {
        static NSString *indetfire = @"cell";
        QueryCustomerTableViewCell *cell = (QueryCustomerTableViewCell *)[tableView dequeueReusableCellWithIdentifier:indetfire];
        if(nil == cell)
        {
            cell = [[QueryCustomerTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indetfire];
            tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        }
        cell.queryLabelOne.text = [[self.queryDataArray objectAtIndex:row]objectForKey:@"customerId"];
        cell.queryLabelTwo.text = [[self.queryDataArray objectAtIndex:row]objectForKey:@"customerName"];
        cell.queryLabelThree.text = [[self.queryDataArray objectAtIndex:row]objectForKey:@"tel"];
//        cell.queryLabelFour.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"mobile"];
        cell.queryLabelFive.text = [[self.queryDataArray objectAtIndex:row]objectForKey:@"mobile"];
//        cell.queryLabelSix.text = [[self.CarModifyDataArray objectAtIndex:row]objectForKey:@"fax"];
        cell.queryLabelSeven.text = [[self.queryDataArray objectAtIndex:row]objectForKey:@"fax"];
        cell.queryLabelEight.text = [[self.queryDataArray objectAtIndex:row]objectForKey:@"address"];

        return cell;
    }
    return 0;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(tableView == self.queryTableView)
    {
        return 45;
    }
    return 40;
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.selectionStyle = UITableViewCellSelectionStyleNone;;
    if(indexPath.row%2 == 1)
    {
        cell.backgroundColor = [[UIColor alloc]initWithRed:0.96 green:0.96 blue:0.96 alpha:1];
    }
    else
    {
        cell.backgroundColor = [[UIColor alloc]initWithRed:226.00/255 green:226.00/255 blue:226.00/255 alpha:1];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
#pragma mark - 返回按钮的回调
-(void)CarBack:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
    [self removeNotification];
}
#pragma mark - 固定界面

-(void)loadfixedPicture
{
    
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [backButton setImage:[UIImage imageNamed:@"返回.png"] forState:UIControlStateNormal];
    [backButton setFrame:CGRectMake(70, 35, 45, 60)];
    [backButton addTarget:self action:@selector(CarBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
    
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(20, 95, 1000, 11)];
    image.image = [UIImage imageNamed:@"渐变分割线.png"];
    [self.view addSubview:image];
    UILabel *imagetitel = [[UILabel alloc]initWithFrame:CGRectMake(160, 55, 180, 35)];
    imagetitel.text = @"车辆信息编辑";
    imagetitel.backgroundColor = [UIColor clearColor];
    imagetitel.textColor = [UIColor grayColor];
    imagetitel.font = [UIFont fontWithName:@"ArialMT" size:29];
    [self.view addSubview:imagetitel];
    
    UILabel *baoxiu = [[UILabel alloc]initWithFrame:CGRectMake(370, 325, 120, 30)];
    baoxiu.backgroundColor = [UIColor clearColor];
    baoxiu.text = @"是否保修车辆";
    baoxiu.textColor = [UIColor grayColor];
    baoxiu.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.backgroundView addSubview:baoxiu];
    
    NSMutableArray *labelMutabelArray = [[NSMutableArray alloc]initWithObjects:@"     车 架 号:",@"   生产厂家:",@"     车 牌 号:",@"       型   号:",@"   发动机号:",@"   变速箱号:",@"       年   款:",@"     排 气 量:",@"变速箱类型:", nil];
    for(int i = 0; i < 9;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(15, (55+i*45), 100, 25)];
        [titlelabel setBackgroundColor:[UIColor clearColor]];
        titlelabel.text = [labelMutabelArray objectAtIndex:i];
        titlelabel.textColor = [UIColor grayColor];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:15];
        [self.backgroundView addSubview:titlelabel];
    }
    NSMutableArray *labelMutabelArray1 = [[NSMutableArray alloc]initWithObjects:@"内装颜色:",@"车辆颜色:",@"钥  匙  号:",@"国家代码:",@"车辆用途:",@"保修序号:",nil];
    for(int i = 0; i < 6;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(295, (55+i*45), 100, 25)];
        [titlelabel setBackgroundColor:[UIColor clearColor]];
        titlelabel.text = [labelMutabelArray1 objectAtIndex:i];
        titlelabel.textColor = [UIColor grayColor];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:15];
        [self.backgroundView addSubview:titlelabel];
    }
    self.baoXiuDaoQi = [[UILabel alloc]initWithFrame:CGRectMake(283, 372, 140, 25)];
    [self.baoXiuDaoQi setBackgroundColor:[UIColor clearColor]];
    self.baoXiuDaoQi.text = @"   保修月数:";
    self.baoXiuDaoQi.textColor = [UIColor grayColor];
    self.baoXiuDaoQi.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.backgroundView addSubview:self.baoXiuDaoQi];
    
    UILabel *remark = [[UILabel alloc]initWithFrame:CGRectMake(15, 457, 140, 25)];
    [remark setBackgroundColor:[UIColor clearColor]];
    remark.text = @"   重要提示:";
    remark.textColor = [UIColor grayColor];
    remark.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.backgroundView addSubview:remark];
    
    UILabel *importantNotice = [[UILabel alloc]initWithFrame:CGRectMake(15, 498, 140, 25)];
    [importantNotice setBackgroundColor:[UIColor clearColor]];
    importantNotice.text = @"      备   注:";
    importantNotice.textColor = [UIColor grayColor];
    importantNotice.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.backgroundView addSubview:importantNotice];
    
    self.baoXiuLiChen = [[UILabel alloc]initWithFrame:CGRectMake(295, 417, 140, 25)];
    [self.baoXiuLiChen setBackgroundColor:[UIColor clearColor]];
    self.baoXiuLiChen.text = @"保修里程:";
    self.baoXiuLiChen.textColor = [UIColor grayColor];
    self.baoXiuLiChen.font = [UIFont fontWithName:@"ArialMT" size:15];
    [self.baoXiuLiChen setHidden:YES];
    [self.backgroundView addSubview:self.baoXiuLiChen];
    NSMutableArray *labelMutabelArray2 = [[NSMutableArray alloc]initWithObjects:@"       保  险  公  司:",@"      保险购买日期:",@"      保险到期日期:",@"      年检开始日期:",@"       购  买  日  期:",@"       上  牌  日  期:",@"   第一次来厂日期:",@"最后一次来厂里程:", nil];
    for(int i = 0; i < 8;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(550, (55+i*45), 140, 25)];
        [titlelabel setBackgroundColor:[UIColor clearColor]];
        titlelabel.text = [labelMutabelArray2 objectAtIndex:i];
        titlelabel.textColor = [UIColor grayColor];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:15];
        [self.backgroundView addSubview:titlelabel];
    }
    NSMutableArray *labelMutabelArrayOne = [[NSMutableArray alloc]initWithObjects:@"客户",@"客户编号",@"客户名称",@"客户性质",@"手机",@"联系电话",@"传真",@"联系地址", nil];
    for(int i = 0; i < 8;i++)
    {
        UILabel *titlelabel = [[UILabel alloc]initWithFrame:CGRectMake((0+i*110), 535, 113, 40)];
        [titlelabel setBackgroundColor:[[UIColor alloc]initWithRed:240.00/255 green:240.00/255 blue:240.00/255 alpha:1]];
        titlelabel.text = [labelMutabelArrayOne objectAtIndex:i];
        [titlelabel setTextColor:[UIColor grayColor]];
        titlelabel.font = [UIFont fontWithName:@"ArialMT" size:16];
        [titlelabel setTextAlignment:NSTextAlignmentCenter];
        [self.backgroundView addSubview:titlelabel];
    }
    UIImageView *xingxingimage1 = [[UIImageView alloc]initWithFrame:CGRectMake(15, 58, 10, 10)];
    [xingxingimage1 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage1];
    UIImageView *xingxingimage2 = [[UIImageView alloc]initWithFrame:CGRectMake(15, 105, 10, 10)];
    [xingxingimage2 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage2];
    UIImageView *xingxingimage3 = [[UIImageView alloc]initWithFrame:CGRectMake(15, 195, 10, 10)];
    [xingxingimage3 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage3];
    UIImageView *xingxingimage4 = [[UIImageView alloc]initWithFrame:CGRectMake(15, 240, 10, 10)];
    [xingxingimage4 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage4];
    UIImageView *xingxingimage5 = [[UIImageView alloc]initWithFrame:CGRectMake(15, 285, 10, 10)];
    [xingxingimage5 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage5];
    UIImageView *xingxingimage8 = [[UIImageView alloc]initWithFrame:CGRectMake(15, 330, 10, 10)];
    [xingxingimage8 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage8];

    UIImageView *xingxingimage6 = [[UIImageView alloc]initWithFrame:CGRectMake(565, 240, 10, 10)];
    [xingxingimage6 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage6];
    UIImageView *xingxingimage7 = [[UIImageView alloc]initWithFrame:CGRectMake(550, 330, 10, 10)];
    [xingxingimage7 setImage:[UIImage imageNamed:@"xingxing.png"]];
    [self.backgroundView addSubview:xingxingimage7];
     
    
}

#pragma mark - 保存按钮的回调
-(void)saveButton:(id)sender
{
    if(self.buyDate.titleLabel.text == nil)
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"购买日期不能为空！" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
        [alertView show];
    }
    else if(self.firstTimeDate.titleLabel.text == nil)
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"第一次来厂日期不能为空！" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
        [alertView show];
    }
    else
    {
      
        //拿到已编辑好数据
        self.carModifyDataDit = [[NSMutableDictionary alloc]initWithCapacity:10];
        //车架号
        [self.carModifyDataDit setObject:self.carframe.text forKey:@"vin"];
        //生产厂家
        if([self.manufacturer.titleLabel.text isEqualToString:@"[01] 广汽乘用车"])
        {
            [self.carModifyDataDit setObject:@"01" forKey:@"manufactureName"];
        }
        if([self.manufacturer.titleLabel.text isEqualToString:@"[02] 其他"])
        {
            [self.carModifyDataDit setObject:@"02" forKey:@"manufactureName"];
        }
        if([self.manufacturer.titleLabel.text isEqualToString:@"[03] "])
        {
            [self.carModifyDataDit setObject:@"03" forKey:@"manufactureName"];
        }
        if([self.manufacturer.titleLabel.text isEqualToString:@"[99] 其他厂家"])
        {
            [self.carModifyDataDit setObject:@"99" forKey:@"manufactureName"];
        }
        //车牌号
        if(self.licenseplate.text != nil)
        {
            [self.carModifyDataDit setObject:self.licenseplate.text forKey:@"plateNumber"];
        }
        //型号
        if(self.model.titleLabel.text != nil)
        {
            NSMutableArray *carTypeName = [[NSMutableArray alloc]init];
            NSMutableArray *carTypeId = [[NSMutableArray alloc]init];
            for(int i = 0; i<[self.carTypeArray count];i++)
            {
                [carTypeName addObject:[[self.carTypeArray objectAtIndex:i] objectForKey:@"carTypeName"]];
                [carTypeId addObject:[[self.carTypeArray objectAtIndex:i] objectForKey:@"carTypeId"]];
            }
            if([carTypeName containsObject:self.model.titleLabel.text])
            {
                NSString *carTypeText = [carTypeId objectAtIndex:[carTypeName indexOfObject:self.model.titleLabel.text]];
                [self.carModifyDataDit setObject:carTypeText forKey:@"carType"];
            }
        }
        //发动机号
        if(self.engineField.text != nil)
        {
            [self.carModifyDataDit setObject:self.engineField.text forKey:@"engineNumber"];
        }
        //变速箱号
        if(self.transmissionField.text != nil)
        {
            [self.carModifyDataDit setObject:self.transmissionField.text forKey:@"gearBoxNumber"];
        }
        //年款
        if(self.Inparagraph.text != nil)
        {
            [self.carModifyDataDit setObject:self.Inparagraph.text forKey:@"year"];
        }
        //排气量
        if(self.exhaust.text != nil)
        {
            [self.carModifyDataDit setObject:self.exhaust.text forKey:@"emission"];
        }
        //变速箱类型
        if(self.transmissionType.titleLabel.text != nil)
        {
            [self.carModifyDataDit setObject:self.transmissionType.titleLabel.text forKey:@"gearBoxType"];
        }
        //内装颜色
        if(self.insideColor.titleLabel.text != nil)
        {
            NSMutableArray *aInColorName = [[NSMutableArray alloc]init];
            NSMutableArray *aInColorId = [[NSMutableArray alloc]init];
            for(int i = 0; i<[self.neiZhuangColorArray count];i++)
            {
                [aInColorName addObject:[[self.neiZhuangColorArray objectAtIndex:i] objectForKey:@"carInerColorName"]];
                [aInColorId addObject:[[self.neiZhuangColorArray objectAtIndex:i] objectForKey:@"carInerColorId"]];
            }
            if([aInColorName containsObject:self.insideColor.titleLabel.text])
            {
                NSString *aInColorText = [aInColorId objectAtIndex:[aInColorName indexOfObject:self.insideColor.titleLabel.text]];
                [self.carModifyDataDit setObject:aInColorText forKey:@"insideColor"];
            }
        }
        //车辆颜色
        if(self.carClolr.titleLabel.text != nil)
        {
            NSMutableArray *carColorName = [[NSMutableArray alloc]init];
            NSMutableArray *carColorId = [[NSMutableArray alloc]init];
            for(int i = 0; i<[self.cheLiangColorArray count];i++)
            {
                [carColorName addObject:[[self.cheLiangColorArray objectAtIndex:i] objectForKey:@"carColorName"]];
                [carColorId addObject:[[self.cheLiangColorArray objectAtIndex:i] objectForKey:@"carColorId"]];
            }
            if([carColorName containsObject:self.carClolr.titleLabel.text])
            {
                NSString *carColorText = [carColorId objectAtIndex:[carColorName indexOfObject:self.carClolr.titleLabel.text]];
                [self.carModifyDataDit setObject:carColorText forKey:@"carColor"];
            }
        }
        //钥匙号
        if(self.keyNumber.text == nil || [self.keyNumber.text isEqualToString:@""])
        {
            self.keyNumber.text = @"";
        }
        [self.carModifyDataDit setObject:self.keyNumber.text forKey:@"keyNumber"];
        //国家代码
        if(self.countriesCodeName.titleLabel.text != nil)
        {
            if([self.countriesCodeName.titleLabel.text isEqualToString:@"中国"])
            {
                [self.carModifyDataDit setObject:@"CHN" forKey:@"countryCode"];
            }
            if([self.countriesCodeName.titleLabel.text isEqualToString:@"日本"])
            {
                [self.carModifyDataDit setObject:@"JPN" forKey:@"countryCode"];
            }
        }
        //车辆用途
        if(self.carUse.titleLabel.text != nil)
        {
            if([self.carUse.titleLabel.text isEqualToString:@"上下班"])
            {
                [self.carModifyDataDit setObject:@"1" forKey:@"carUse"];
            }
            if([self.carUse.titleLabel.text isEqualToString:@"公事"])
            {
                [self.carModifyDataDit setObject:@"2" forKey:@"carUse"];
            }
            if([self.carUse.titleLabel.text isEqualToString:@"休闲"])
            {
                [self.carModifyDataDit setObject:@"3" forKey:@"carUse"];
            }
            if([self.carUse.titleLabel.text isEqualToString:@"其他"])
            {
                [self.carModifyDataDit setObject:@"0" forKey:@"carUse"];
            }
        }
        //保修序号
        if(self.warrantyNumber.text == nil || [self.warrantyNumber.text isEqualToString:@""])
        {
            self.warrantyNumber.text = @"";
        }
        [self.carModifyDataDit setObject:self.warrantyNumber.text forKey:@"WarrantyNumber"];
        //保修月数
        if(self.monthsOfNumber.text == nil || [self.monthsOfNumber.text isEqualToString:@""])
        {
            self.monthsOfNumber.text = @"";
        }
        [self.carModifyDataDit setObject:self.monthsOfNumber.text forKey:@"WarrantyMonths"];
        //保修里程
        if(self.liChenShuRu.text == nil || [self.liChenShuRu.text isEqualToString:@""])
        {
            self.liChenShuRu.text = @"";
        }
        [self.carModifyDataDit setObject:self.liChenShuRu.text forKey:@"WarrantyMileage"];
        //保险公司
        if(self.baoxiangongsi.text == nil || [self.baoxiangongsi.text isEqualToString:@""])
        {
            self.baoxiangongsi.text = @"";
        }
        [self.carModifyDataDit setObject:self.baoxiangongsi.text forKey:@"insuranceCompany"];
        //保险购买日期
        if(self.baoxiangoumai.text == nil || [self.baoxiangoumai.text isEqualToString:@""])
        {
            self.baoxiangoumai.text = @"";
        }
        [self.carModifyDataDit setObject:self.baoxiangoumai.text forKey:@"insuranceBuyDate"];
        //保险到期日期
        if(self.baoxiandaoqi.text == nil || [self.baoxiandaoqi.text isEqualToString:@""])
        {
            self.baoxiandaoqi.text = @"";
        }
        [self.carModifyDataDit setObject:self.baoxiandaoqi.text forKey:@"insuranceExpiresDate"];
        //年检开始日期
        if(self.checkStartDate.titleLabel.text == nil || [self.checkStartDate.titleLabel.text isEqualToString:@""])
        {
            self.checkStartDate.titleLabel.text = @"";
        }
        [self.carModifyDataDit setObject:self.checkStartDate.titleLabel.text forKey:@"yearCheckStartDate"];
        //购买日期
        if(self.buyDate.titleLabel.text == nil || [self.buyDate.titleLabel.text isEqualToString:@""])
        {
            self.buyDate.titleLabel.text = @"";
        }
        [self.carModifyDataDit setObject:self.buyDate.titleLabel.text forKey:@"buyDate"];
        //上牌日期
        if(self.registrationDate.titleLabel.text == nil || [self.registrationDate.titleLabel.text isEqualToString:@""])
        {
            self.registrationDate.titleLabel.text = @"";
        }
        [self.carModifyDataDit setObject:self.registrationDate.titleLabel.text forKey:@"plateDate"];
        //第一次来厂日期
        if(self.firstTimeDate.titleLabel.text == nil || [self.firstTimeDate.titleLabel.text isEqualToString:@""])
        {
            self.firstTimeDate.titleLabel.text = @"";
        }
        [self.carModifyDataDit setObject:self.firstTimeDate.titleLabel.text forKey:@"firstComingDate"];
        //最后一次来厂里程
        if(self.lastComingMileage.text == nil || [self.lastComingMileage.text isEqualToString:@""])
        {
            self.lastComingMileage.text = @"";
        }
        [self.carModifyDataDit setObject:self.lastComingMileage.text forKey:@"lastComingMileage"];
        //重要提示
        if(self.importantNotice.text == nil || [self.importantNotice.text isEqualToString:@""])
        {
            self.importantNotice.text = @"";
        }
        [self.carModifyDataDit setObject:self.importantNotice.text forKey:@"importantNotice"];
        //备注
        if(self.remark.text == nil || [self.remark.text isEqualToString:@""])
        {
            self.remark.text = @"";
        }
        [self.carModifyDataDit setObject:self.remark.text forKey:@"remark"];
        //车主，使用者，驾驶员列表
        [self.carModifyDataDit setObject:self.CarModifyDataArray forKey:@"customerList"];
        
        
        //发送消息将数据传给详细页面
        NSNotification *notification = [NSNotification notificationWithName:@"carModifyDataDit" object:self.carModifyDataDit];
        [[NSNotificationCenter defaultCenter]postNotification:notification];
        
        webService *web = [[webService alloc]init];
        web.methodName = UPDATEREPAIRCAR;
        [web commonPostSharedRequest:UPDATEREPAIRCAR psotDic:self.carModifyDataDit];
        //[SVProgressHUD showWithStatus:@"保存中......" maskType:SVProgressHUDMaskTypeGradient];
        
    }
}
-(void)updateRepairCar:(NSNotification*)notification
{
    //[SVProgressHUD dismiss];
    NSMutableDictionary *theJson = [NSJSONSerialization JSONObjectWithData:(NSData *)notification.object options:NSJSONReadingMutableLeaves error:nil];
    if([[theJson valueForKey:@"error_code"] intValue])
    {
//        NSLog(@"*!*!*!*!*!%@",[theJson valueForKey:@"error_code"]);
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:[theJson valueForKey:@"error_msg"] message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
        [alertView show];
    }
    else
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"修改成功！" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
        [alertView show];
        [self.navigationController popViewControllerAnimated:YES];
        [self removeNotification];
        
    }
}
//弹出回调方法
-(void)selectDelegate:(NSInteger)row btn:(UIButton *)btn
{
    [self.popCon dismissPopoverAnimated:YES];
    self.popCon = nil;
}
-(void)textFieldDidBeginEditing:(UITextField *)textField     //弹出键盘的时候上提
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.4];
    [self.view setFrame:CGRectMake(0, 0-180, 1024, 768)];
    [UIView commitAnimations];
}
- (void)keyboardHide:(NSNotification *)notif   //键盘即将消失的时候点done归为view
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.3];
    [self.view setFrame:CGRectMake(0, 0, 1024, 768)];
    [UIView commitAnimations];
}
-(void)addNotification
{
    //获取车型列表
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCarType:) name:GETCARTYPENAMELIST object:nil];
    //获取内饰颜色列表
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCarInnerColorList:) name:GETCARINNERCOLORLIST object:nil];
    //获取车辆颜色列表
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getcarColorList:) name:GETCARCOLORLIST object:nil];
    //车辆信息修改
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(updateRepairCar:) name:UPDATEREPAIRCAR object:nil];
    //多客户分配
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(searchCustomerList:) name:SEARCHCUSTOMERLIST object:nil];
    //通用代码表的字典
    self.dicTmp = [HelpClass returnTheDataByJsonFileAndJustForTestWithFileName:@"codeA" andType:@"json"];
    //表格数据的数组
    self.CarModifyDataArray = [NSMutableArray arrayWithArray:[self.carModifyDataDit objectForKey:@"customerList"]];
    //生产厂家列表
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getManufactureList:) name:GETMANUFACTURELIST object:nil];
    //车主详细信息
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(ownerDetail:) name:GETREPAIRCUSTOMERDETAIL object:nil];
}
-(void)removeNotification
{
    [[NSNotificationCenter defaultCenter]removeObserver:self];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end